#!/usr/bin/python
# -*- coding:utf-8 -*-
# @author  : xuexiaohua
# @time    : 2025/8/20 14:04
# @function: the script is used to do something.
# @version :
import redis

host = 'localhost'
port = 6379
db = 0

class RedisUtil:
    def __init__(self):
        self.host = host
        self.port = port
        self.db = db

    def redis_connect(self):
        r = redis.Redis(host=self.host, port=self.port, db=self.db)
        return r

    def redis_set(self, key, value):
        r = self.redis_connect()
        r.set(key, value)

    def redis_get(self, key):
        r = self.redis_connect()
        return r.get(key)

    def redis_delete(self, key):
        r = self.redis_connect()
        r.delete(key)


if __name__ == '__main__':
    r = RedisUtil()
    r = r.redis_connect()
    print(r.get('key'))

